home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Semaphore / Source / CSemaphorePicture.cp < prev    next >
Text File  |  2000-06-23  |  891b  |  40 lines

  1. // CSemaphorePicture.cp
  2.  
  3. #include "CSemaphorePicture.h"
  4. #include <ctype.h>
  5.  
  6.  
  7. CSemaphorePicture::CSemaphorePicture(
  8.     LStream*    inStream): LPicture(inStream)
  9. {
  10.  
  11. }
  12.  
  13. CSemaphorePicture::~CSemaphorePicture()
  14. {
  15.     // do nothing
  16. }
  17.  
  18. // ---------------------------------------------------------------------------------
  19. //    • HandleKeyPress                                            
  20. // ---------------------------------------------------------------------------------
  21. //    Interpret key commands
  22.  
  23. Boolean
  24. CSemaphorePicture::HandleKeyPress( const EventRecord&    inKeyEvent)
  25. {
  26.     int    theKey = (unsigned char) inKeyEvent.message & charCodeMask;
  27.     int    thePicture = 0;
  28.     
  29.     if (theKey==' ') {
  30.         thePicture = 0;
  31.     } else if (('A' <= theKey) && (theKey <= 'Z')) {
  32.         thePicture = (theKey - int('A') + 1);
  33.     } else if (('a' <= theKey) && (theKey <= 'z')) {
  34.         thePicture = (theKey - int('a') + 101);
  35.     }
  36.     SetPictureID(thePicture);
  37.     Refresh();
  38.     return true;
  39. }
  40.